package jvm;

import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.Element;
import javax.lang.model.element.TypeElement;
import java.util.Set;

public class NameCheckerProcessor extends AbstractProcessor {

    private NameChecker nameChecker;


    @Override
    public void init(ProcessingEnvironment processingEnvironment) {
        super.init(processingEnvironment);
        nameChecker = new NameChecker(processingEnvironment);

    }

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnvironment) {
        if (!roundEnvironment.processingOver()){
            for (Element rootElement : roundEnvironment.getRootElements()) {
                nameChecker.checkName(rootElement);
            }
        }
        return false;
    }
}
